package icu.wangrui.bookstore.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyMvcConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        //前台
        registry.addViewController("/userlogin.html").setViewName("/user/page/login");//消费者登录页
        registry.addViewController("/user/page/index").setViewName("user/page/index");//消费者首页
        registry.addViewController("/user-regist.html").setViewName("user/page/test-regist");//消费者注册
        registry.addViewController("/lookforward.html").setViewName("user/page/lookforward");//未开发页面
        registry.addViewController("/password-change.html").setViewName("user/page/password-change");//
        registry.addViewController("/forget-password.html").setViewName("user/page/forget-password.html");//


        //后台
    /*    registry.addViewController("/adminlogin.html").setViewName("/admin/page/login");//后台管理员登录页*/
        registry.addViewController("/adminindex.html").setViewName("/admin/page/index");//者首页
        registry.addViewController("/admin/page/index").setViewName("/admin/page/index");//者首页

     /*   registry.addViewController("/userlogin.html").setViewName("/user/page/login");
        registry.addViewController("/usermain.html").setViewName("/user/page/index");*/
    }
/*    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AdminLoginHandelInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/",
                        "/userlogin.html",
                        "/adminlogin.html",
                        "/admin/page/login",
                        "/admin/login",
                        "/admin/css/**",
                        "/admin/js/**",
                        "/admin/img/**",
                        "/user/**",
                        "/user-regist.html",
                        "/lookforward.html",
                        "/commons/**"
                );
    }*/
}
